#pragma once

#include "MGUI_Entry.h"

namespace Myway
{
	class MGUI_ENTRY MGUI_Color
	{
		DECLARE_ALLOC();

	public:
		static const MGUI_Color White;
		static const MGUI_Color Red;
		static const MGUI_Color Green;
		static const MGUI_Color Blue;
		static const MGUI_Color Black;
		static const MGUI_Color Gray;

	public:
		struct {
			float r;
			float g;
			float b;
			float a;
		};

		MGUI_Color() { r = g = b = 0; a = 1; }
		MGUI_Color(float v);
		MGUI_Color(float r, float g, float b, float a = 1.0f);
		MGUI_Color(const MGUI_Color & c);

		MGUI_Color& operator =(const MGUI_Color & c);
		MGUI_Color operator +(const MGUI_Color & c) const;
		MGUI_Color operator -(const MGUI_Color & c) const;
		MGUI_Color operator *(const MGUI_Color & c) const;
		MGUI_Color operator *(float v) const;
		MGUI_Color operator /(float v) const;

		MGUI_Color& operator +=(const MGUI_Color & c);
		MGUI_Color& operator -=(const MGUI_Color & c);
		MGUI_Color& operator *=(const MGUI_Color & c);
		MGUI_Color& operator *=(float v);
		MGUI_Color& operator /=(float v);

		bool operator ==(const MGUI_Color & c) const;
		bool operator !=(const MGUI_Color & c) const;

		friend MGUI_Color operator *(float v, const MGUI_Color & c) ;

	public:
		void Saturate();

		TString128 ToString() const;
		void FromString(const TString128 & str);
	};
}
